#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <string>
#include <algorithm>


std::string Multiply(const std::string& a, const std::string& b) {
	int tmp[1200]{};
	int arra[550]{};
	int arrb[550]{};

	int lena = a.length();
	int lenb = b.length();

	for (int i = 1; i <= lena; i++) {
		arra[i] = a[lena - i] - '0';
	}
	for (int i = 1; i <= lenb; i++) {
		arrb[i] = b[lenb - i] - '0';
	}

	int len = std::min(500, lena + lenb - 1);
	for (int i = 1; i <= lena; i++) {
		for (int j = 1; j <= lenb; j++) {
			if (i + j - 1 > len) {
				break;
			}
			tmp[i + j - 1] += arra[i] * arrb[j];
		}
	}

	for (int i = 1; i <= len; i++) {
		tmp[i + 1] += tmp[i] / 10;
		tmp[i] %= 10;
	}

	while (tmp[len + 1]) {
		len++;
		tmp[len + 1] += tmp[len] / 10;
		tmp[len] %= 10;
	}

	std::string result(len, '0');

	for (int i = 0; i < len; i++) {
		result[i] = tmp[len - i] + '0';
	}

	return result;
}

std::string QuickPower2(int P) {
	std::string ans = "1";
	std::string base = "2";

	while (P) {
		if (P % 2 == 1) {
			ans = Multiply(ans, base);
		}
		base = Multiply(base, base);
		P = P / 2;
	}

	return ans;
}

/**
 * https://www.luogu.com.cn/problem/P1045
 * 麦森数
 */
int main() {
	int P;
	scanf("%d", &P);

	int Q = P;
	double ans = 1;
	int cnt = 1;
	while (Q--) {
		ans = ans * 2;
		while (ans > 10) {
			ans = ans / 10;
			cnt++;
		}
	}

	printf("%d\n", cnt);

	std::string result = QuickPower2(P);
	int len = result.length();

	result[len - 1] = result[len - 1] - 1;

	if (len >= 500) {
		int cnt = 0;
		for (int i = len - 500; i < len; i++) {
			printf("%c", result[i]);
			cnt++;
			if (cnt == 50) {
				printf("\n");
				cnt = 0;
			}
		}
	}
	else {
		int diff = 500 - len;
		int cnt = 0;
		for (int i = 0; i < diff; i++) {
			printf("0");
			cnt++;
			if (cnt == 50) {
				printf("\n");
				cnt = 0;
			}
		}

		for (int i = 0; i < len; i++) {
			printf("%c", result[i]);
			cnt++;
			if (cnt == 50) {
				printf("\n");
				cnt = 0;
			}
		}
	}


	return 0;
}